package com.kai.service.Impl;

import com.kai.dao.UserMapper;
import com.kai.pojo.NameValue;
import com.kai.pojo.User;
import com.kai.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    public User selectUser(User user) {
        return userMapper.selectUser(user);
    }
    public int selectByName(String name){
        return userMapper.selectByName(name);
    }
    public int selectByPassword(String password){
        return userMapper.selectByPassword(password);
    }

    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public List<User> selectAllUser(String name,String sex,int pageNum,int pageSize) {
        return userMapper.selectAllUser(name,sex,pageNum,pageSize);
    }

    @Override
    public int updateUserState(String state, String id) {
        return userMapper.updateUserState(state, id);
    }

    @Override
    public int updateUserInfo(User user) {
        return userMapper.updateUserInfo(user);
    }

    @Override
    public int deleteUser(String id) {
        return userMapper.deleteUser(id);
    }

    @Override
    public int selectAllUserCount(String name,String sex) {
        return userMapper.selectAllUserCount(name,sex);
    }

    @Override
    public int selectUserByName(String name) {
        return userMapper.selectUserByName(name);
    }

    @Override
    public List<NameValue> selectAddUserCount() {
        return userMapper.selectAddUserCount();
    }

    @Override
    public int addUsersPerDay(String s) {
        return userMapper.addUsersPerDay(s);
    }

    @Override
    public int register(User user) {
        return userMapper.register(user);
    }

    @Override
    public int updatePassword(String id, String password) {
        return userMapper.updatePassword(id,password);
    }

    @Override
    public int oldPassword(String id, String password) {
        return userMapper.oldPassword(password,id);
    }

    @Override
    public int validateName(String name) {
        return userMapper.validateName(name);
    }

    @Override
    public List<User> selectAllUserExecl() {
        return userMapper.selectAllUserExecl();
    }


}
